import { IStoreState, IStoreAction } from '@/types/store';

export const reducer = (state: IStoreState, action: IStoreAction) => {
    switch (action.type) {
        case 'setConsName':
            return {...state, ...{consName: action.data}};
        case 'setFiled':
            return {...state, ...{filed: action.data}};
        case 'setData':
            return {...state, ...{[state.filed as string]: action.data}};
        default:
            return state;
    }
};
